#include "stdafx.h"
#include "AttackerAs.h"


AttackerAs::AttackerAs(Attack* pAttack) : As(ATTACKER_ID), TheAttack(pAttack)
{
}

// After using this constructor, you must set TheAttack before using BgpIteration/InitialIntroduceMyselfToNeighbors
AttackerAs::AttackerAs() : As(ATTACKER_ID), TheAttack(0)
{
}


AttackerAs::~AttackerAs()
{
}

void AttackerAs::UpdateOnRcvSelectedPathsFromNeighbor(As* pSender, BgpMessage& pMsg)
{
}

void AttackerAs::InitialIntroduceMyselfToNeighbors()
{
	As::InitialIntroduceMyselfToNeighbors();
	BgpIteration();
}

void AttackerAs::BgpIteration()
{
	// Iteration Initialization
	WasUpdateOnSelectedPaths = false;
	
	Set<As*>& whoToSendTo = *(TheAttack->WhoToSendTo);
	Set<As*>::iterator whoToSendToIter;
	for (whoToSendToIter = whoToSendTo.begin(); whoToSendToIter != whoToSendTo.end(); ++whoToSendToIter)
	{
		(*whoToSendToIter)->UpdateOnRcvSelectedPathsFromNeighbor(this, *(TheAttack->Msg));
	}
}

